﻿<%@ Page Title="Home" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="list.aspx.vb" Inherits="LondonItalianRestaurants.list" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource2">
    
    <ItemTemplate>
    
    <a href="list.aspx?TagName=<%#Eval("TagName") %>">
    <%#Eval("TagName") %>
    </a> |
    </ItemTemplate>
    </asp:Repeater>
    <br />
    <br />
    <br />

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
    DataKeyNames="ID" DataSourceID="SqlDataSource3" AllowSorting="True" 
        BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" 
        CellPadding="3" CellSpacing="1" GridLines="None">
    <Columns>
        <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
            ReadOnly="True" SortExpression="ID" />
        
        <asp:HyperLinkField DataNavigateUrlFields="ID" 
            DataNavigateUrlFormatString="Details.aspx?ID={0}" 
            DataTextField="RestaurantName" HeaderText="RestaurantName" SortExpression="RestaurantName" />

            <asp:BoundField DataField="RestaurantAddress" HeaderText="RestaurantAddress" 
            SortExpression="RestaurantAddress" />
            <asp:TemplateField HeaderText="MichelinStars" SortExpression="MichelinStars">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("MichelinStars") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                    <b> 

                        <asp:Label ID="Label1" runat="server" ForeColor="Red" Font-Size="X-Large"  Text='<%# ShowStars(Eval("MichelinStars")) %>'></asp:Label></b>
                    </ItemTemplate>
                </asp:TemplateField>

        

        <asp:ImageField DataImageUrlField="RestaurantPicture" HeaderText="Thumbnail">
            <ControlStyle CssClass="RestaurantPicture" Width="200px" Height="200px" />
        </asp:ImageField>
        
        
        
    </Columns>
        <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
        <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
        <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
        <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
        <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#F1F1F1" />
        <SortedAscendingHeaderStyle BackColor="#594B9C" />
        <SortedDescendingCellStyle BackColor="#CAC9C9" />
        <SortedDescendingHeaderStyle BackColor="#33276A" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
    ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
    
        SelectCommand="SELECT [ID], [RestaurantName], [MichelinStars], [RestaurantPicture], [RestaurantAddress] FROM [Restaurants]">
</asp:SqlDataSource>
    <br />
    <br />
<asp:SqlDataSource ID="SqlDataSource3" runat="server" 
    ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
    ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
    
        
        SelectCommand="SELECT [ID], [RestaurantName], [TagName], [RestaurantAddress], [AveragePrice], [Website], [MichelinStars], [RestaurantPicture] FROM [TagRestaurantView] WHERE ([TagName] = ?)">
    <SelectParameters>
        <asp:QueryStringParameter Name="TagName" QueryStringField="TagName" 
            Type="String" />
    </SelectParameters>
</asp:SqlDataSource>
    <br />
    
    <br />
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
        SelectCommand="SELECT [TagName] FROM [Tags]"></asp:SqlDataSource>
    <br />
    <asp:TextBox ID="tb_TagSearch" runat="server"></asp:TextBox>
    <asp:Button ID="btn_TagSearch" runat="server" Text="Search" />
</asp:Content>
